<?php

namespace app\common\business;

class Demo
{
    public function getDemoDataByCategoryId($categoryId)
    {
        // 库里获取数据
        $demoModel = new \app\common\model\mysql\demo();
        $results = $demoModel->getDemoDataByCategoryId($categoryId, 6);

        if (empty($results)) {
            return [];
        }

        $categorys = config("test");
        foreach ($results as $key => $result) {
//            echo $key . PHP_EOL;
//            echo $result . PHP_EOL;
//            echo $categorys[$result['is_show_stock']];
            $results[$key]['cateTest'] = $categorys[$result['is_show_stock']] ?? "其他";
        }
        return $results;
    }
}